﻿<phone:PhoneApplicationPage x:Class="CacheTestApp.MainPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:Cache="clr-namespace:NCache;assembly=NCache4WP8"
                            xmlns:ViewModels="clr-namespace:CacheTestApp.ViewModels"
                            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            FontFamily="{StaticResource PhoneFontFamilyNormal}"
                            FontSize="{StaticResource PhoneFontSizeNormal}"
                            Foreground="{StaticResource PhoneForegroundBrush}"
                            Orientation="Portrait"
                            SupportedOrientations="Portrait"
                            shell:SystemTray.IsVisible="True"
                            mc:Ignorable="d">
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar>
            <shell:ApplicationBarIconButton x:Name="CancelBtn"
                                            Click="CancelBtn_Click"
                                            IconUri="/Assets/AppBar/cancel.png"
                                            Text="取消" />
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
    <!--
        LOCALIZATION NOTE:
        To localize the displayed strings copy their values to appropriately named
        keys in the app's neutral language resource file (AppResources.resx) then
        replace the hard-coded text value between the attributes' quotation marks
        with the binding clause whose path points to that string name.
        
        For example:
        
        Text="{Binding Path=LocalizedResources.ApplicationTitle, Source={StaticResource LocalizedStrings}}"
        
        This binding points to the template's string resource named "ApplicationTitle".
        
        Adding supported languages in the Project Properties tab will create a
        new resx file per language that can carry the translated values of your
        UI strings. The binding in these examples will cause the value of the
        attributes to be drawn from the .resx file that matches the
        CurrentUICulture of the app at run time.
    -->

    <!--
        Uncomment to see an alignment grid to help ensure your controls are
        aligned on common boundaries.  The image has a top margin of -32px to
        account for the System Tray. Set this to 0 (or remove the margin altogether)
        if the System Tray is hidden.
        
        Before shipping remove this XAML and the image itself.
    -->
    <phone:PhoneApplicationPage.DataContext>
        <ViewModels:MainViewModel />
    </phone:PhoneApplicationPage.DataContext>
    <!--  <Image Source="/Assets/AlignmentGrid.png" VerticalAlignment="Top" Height="800" Width="480" Margin="0,-32,0,0" Grid.Row="0" Grid.RowSpan="2" IsHitTestVisible="False" />  -->
    <Grid x:Name="LayoutRoot">
        <phone:Panorama Template="{StaticResource PanoramaControlTemplate}">
            <phone:Panorama.TitleTemplate>
                <DataTemplate>
                    <TextBlock FontSize="30" Text="口袋购物" />
                </DataTemplate>
            </phone:Panorama.TitleTemplate>
            <!--  Panorama item one  -->
            <phone:PanoramaItem>
                <phone:PanoramaItem.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock FontSize="40" Text="列表缓存(Cancel)" />
                    </DataTemplate>
                </phone:PanoramaItem.HeaderTemplate>
                <Grid>
                    <phone:LongListSelector ItemsSource="{Binding Items}">
                        <phone:LongListSelector.ItemTemplate>
                            <DataTemplate>
                                <Grid Width="480" Height="200">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="4*" />
                                        <ColumnDefinition Width="6*" />
                                    </Grid.ColumnDefinitions>
                                    <Image Grid.Column="0"
                                           Cache:ImageExtensions.CacheUri="{Binding CacheUrl}"
                                           Stretch="UniformToFill" />
                                    <TextBlock Grid.Column="1"
                                               Margin="10"
                                               Text="{Binding Name}" />
                                </Grid>
                            </DataTemplate>
                        </phone:LongListSelector.ItemTemplate>
                    </phone:LongListSelector>
                </Grid>
            </phone:PanoramaItem>

            <!--  Panorama item two  -->
            <phone:PanoramaItem>
                <phone:PanoramaItem.HeaderTemplate>
                    <DataTemplate>
                        <TextBlock FontSize="40" Text="单图缓存(No Cancel)" />
                    </DataTemplate>
                </phone:PanoramaItem.HeaderTemplate>
                <Grid>
                    <Button Margin="0,456,0,31"
                            HorizontalAlignment="Center"
                            Click="Button_Click_1"
                            Content="Button" />

                    <Image Margin="0,0,0,145"
                           Cache:ImageExtensions.CacheUri="http://d04.res.meilishuo.net/pic/l/df/cb/67f50d421947562bcc22afc87730_371_499.c1.jpg"
                           Stretch="UniformToFill" />
                </Grid>
            </phone:PanoramaItem>
        </phone:Panorama>
    </Grid>


</phone:PhoneApplicationPage>